﻿
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using NetCore.ORM.EF;
namespace NetCore.Api.Model
{
    /// <summary>
    /// 接口权限EF 字段映射
    /// </summary>
    public partial class APIPermissionMap : ClassMap<APIPermissionEntity>
    {
        public override void Configure(EntityTypeBuilder<APIPermissionEntity>
        builder)
        {
            builder.ToTable<APIPermissionEntity>("API_Permission");
          
            builder.HasKey(x => x.PermissionId);
            builder.Property(x => x.PermissionId).HasColumnName("PermissionId").HasMaxLength(36);

            /// <summary>
            /// 用户编号
            /// </summary>
            builder.Property(x => x.UserNo).HasColumnName("UserNo").HasMaxLength(50).IsRequired(true);

            /// <summary>
            /// 上级权限
            /// </summary>
            builder.Property(x => x.ParentId).HasColumnName("ParentId").HasMaxLength(50).IsRequired(false);

            /// <summary>
            /// 权限id
            /// </summary>
            builder.Property(x => x.ActionId).HasColumnName("ActionId").HasMaxLength(50).IsRequired(true);

            /// <summary>
            /// 链接
            /// </summary>
            builder.Property(x => x.RouteUrl).HasColumnName("RouteUrl").HasMaxLength(500).IsRequired(false);

            /// <summary>
            /// 描述
            /// </summary>
            builder.Property(x => x.Remark).HasColumnName("Remark").HasMaxLength(500).IsRequired(false);

            /// <summary>
            /// 创建人
            /// </summary>
            builder.Property(x => x.CreateBy).HasColumnName("CreateBy").HasMaxLength(50).IsRequired(true);

            /// <summary>
            /// 创建时间
            /// </summary>
            builder.Property(x => x.CreateDate).HasColumnName("CreateDate").HasColumnType("datetime").IsRequired(true);

            /// <summary>
            /// 修改人
            /// </summary>
            builder.Property(x => x.LastModifyUserId).HasColumnName("LastModifyUserId").HasMaxLength(50).IsRequired(true);

            /// <summary>
            /// 修改时间
            /// </summary>
            builder.Property(x => x.LastModifyDate).HasColumnName("LastModifyDate").HasColumnType("datetime").IsRequired(true);

            /// <summary>
            /// 是否删除
            /// </summary>
            builder.Property(x => x.IsDeleted).HasColumnName("IsDeleted").HasDefaultValue(false);
            base.Configure(builder);
        }
    }
}
